import request from '@/utils/request';

export function getRecordList(deviceId: string, channelId: string, startTime: string, endTime: string) {
  return request({
    url: `/api/gb_record/query/${deviceId}/${channelId}`,
    method: 'get',
    params: {
      startTime,
      endTime
    }
  });
}

export function startPlayback(deviceId: string, channelId: string, startTime: string, endTime: string) {
  return request({
    url: `/api/playback/start/${deviceId}/${channelId}`,
    method: 'get',
    params: {
      startTime,
      endTime
    }
  });
}

export function resumePlayback(streamId: string) {
  return request({
    url: `/api/playback/resume/${streamId}`,
    method: 'get'
  });
}

export function pausePlayback(streamId: string) {
  return request({
    url: `/api/playback/pause/${streamId}`,
    method: 'get'
  });
}

export function speedPlayback(streamId: string, command: string) {
  return request({
    url: `/api/playback/speed/${streamId}/${command}`,
    method: 'get'
  });
}

export function startDownload(deviceId: string, channelId: string, startTime: string, endTime: string, downloadSpeed: string) {
  return request({
    url: `/api/gb_record/download/start/${deviceId}/${channelId}`,
    method: 'get',
    params: {
      startTime,
      endTime,
      downloadSpeed
    }
  });
}

export function stopDownload(deviceId: string, channelId: string, streamId: string) {
  return request({
    url: `/api/gb_record/download/stop/${deviceId}/${channelId}/${streamId}`,
    method: 'get'
  });
}

export function stopPlayback(deviceId: string, channelId: string, streamId: string) {
  return request({
    url: `/api/playback/stop/${deviceId}/${channelId}/${streamId}`,
    method: 'get'
  });
}

export function getCloudRecordList(param: any) {
  return request({
    url: `/api/cloud/record/list`,
    method: 'get',
    params: param
  });
}

export function deleteCloudRecord(param: any) {
  return request({
    url: `/api/cloud/record/delete`,
    method: 'delete',
    params: param
  });
}

export function getCloudRecordDateList(param: any) {
  return request({
    url: `/api/cloud/record/date/list`,
    method: 'get',
    params: param
  });
}

export function addCloudRecordTask(param: any) {
  return request({
    url: `/api/cloud/record/task/add`,
    method: 'get',
    params: param
  });
}

export function getCloudRecordTaskList(param: any) {
  return request({
    url: `/api/cloud/record/task/list`,
    method: 'get',
    params: param
  });
}

export function getDownloadProgress(deviceId: string, channelId: string, streamId: string) {
  return request({
    url: `/api/gb_record/download/progress/${deviceId}/${channelId}/${streamId}`,
    method: 'get'
  });
}

export function stopDownloadRecord(deviceId: string, channelId: string, streamId: string) {
  return request({
    url: `/api/gb_record/download/stop/${deviceId}/${channelId}/${streamId}`,
    method: 'get'
  });
}

export function getCloudRecordPlayPath(recordId: string) {
  return request({
    url: `/api/cloud/record/play/path`,
    method: 'get',
    params: {
      recordId
    }
  });
}
